package main

import (
	"bytes"
	"fmt"
	"unicode/utf8"
)

func main() {

	//str := "你好"
	//str2 := "黑你好"
	//fmt.Println(str,byte(str[0]),[]byte(str))
	//fmt.Println(str2)

	//fmt.Print(strings.Trim("¡¡¡Hello, Gophers!!!", "!¡"))

	//b := []byte("quote:")
	//b = strconv.AppendQuote(b, `"Fran & Freddie's Diner"`)
	//fmt.Println(string(b))
	//fmt.Println([]byte(str))
	//str = formateStr(str,3)
	//fmt.Println([]byte(str))
	//fmt.Printf("%s%s\n",str,str)

	fmt.Println(utf8.RuneCount([]byte("h你")))
	fmt.Println(len("你a"))

}


func formateStr(str string,needLen int) string{
	spaceCode := 32
	strCount := utf8.RuneCountInString(str)
	need := needLen - strCount
	buf := bytes.NewBufferString(str)

	appendSpace := make([]byte,need*2)

	for i := 0; i < len(appendSpace); i++ {
		appendSpace[i] = byte(spaceCode)
	}

	buf.Write(appendSpace)
	return buf.String()
}
